package com.test.session;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.classic.Session;

import com.pojo.Product;

/**
 * @description load和get不需要事务
 * @author Leon Plious
 * @date 2020年7月6日
 */
public class HibernateTestGetNotNeedTransaction {

	
	public static void main(String[] args) {
		
		SessionFactory sf = new Configuration().configure().buildSessionFactory();
		Session session = sf.openSession();
		
		// session.beginTransaction()
		
		Product product = (Product) session.get(Product.class, 1);
		Product product2 = (Product) session.load(Product.class, 1);
		
		
		session.close();
		sf.close();
	}
}
